<h2 class="title">我的提醒</h2>
<{if $data|@count == 0}>
<div class="box-none">
    <img src="/resource/www/imgs/box_none_icon.png" class="img">
    <p class="text">抱歉，你还没有消息提醒！</p>

</div>
<{else}>
<ul class="nt-list">
    <{foreach from=$data item=v}>
    <li class="li fix">
        <div class="left">
            <img src="<{$v.icon}>" class="img">
        </div>
        <div class="center">

            <{if $v.type == 1}>
            <p class="xiaoxi" style="color: rgb(137, 137, 137);">
                <{$v.name}>：
                <{$v.message}>
            </p>
            <{else}>
            <p class="xiaoxi">
                <{$v.name}>：
                <{$v.message}>
            </p>
            <{/if}>

        </div>
        <div class="right">
            <p class="date"><{$v.created}></p>
            <p class="caozuo">

                <a href="javascript:;" onclick="view_notice(this);" data="<{$v.id}>"  class="view">查看</a>
                <{if $v.undel != 1}>
                <a href="javascript:;" onclick="return notice_del_confirm('<{$v.id}>');"   class="del">删除</a>
                <{/if}>
            </p>
        </div>
    </li>
    <{/foreach}>

</ul>
<{$pagination}>
<{/if}>
<script>
$(".notice").addClass("active");

function view_notice(item) {
    if (!$(item).parents('li').find('p').hasClass('auto')) {
        $(item).parents('li').find('p').removeClass('xiaoxi').addClass('auto');
        $(item).parents('li').find('p').css('color', '#898989');
    } else {
        $(item).parents('li').find('p').removeClass('auto').addClass('xiaoxi');
    }

    var id = $(item).attr('data');
    $.get('/tourist/show_notice/'+id,function(data){
        var obj = JSON.parse(data);
        if(obj.status == 0){
            var num = $("#notice_num").html();
            var i = num-1;
            $("#notice_num").html(i);
        }
    });
}

function notice_del_confirm(id){

    layer.confirm('确认删除这条信息吗', {
            btn: ['是的','取消'], //按钮
            title: false,
            area: ['200px', '150px']
        },function(){
            var url = '/tourist/remove_notice/'+id;
            location.href=url;
        },function(){
            return true;
    });

}


</script>
